The Translate method moves or translates a graphic item in the X, Y, or Z dimensions.
; Create the data.
x = FINDGEN(100)
y = 20*Sin(x*2*!PI/25.0)*Exp(-0.01*x)
; Draw the sky and sea.
p = PLOT(x, y, YRANGE=[-40,100], FILL_LEVEL=-40, $
AXIS_STYLE=0, MARGIN=0, DIMENSIONS=[500,400], $
BACKGROUND_COLOR="light sky blue", $
/FILL_BACKGROUND, FILL_COLOR="sea green")
; Draw the sun
e = ELLIPSE(0.9,1, FILL_COLOR="yellow", COLOR="yellow")
; Determine the points for the boat to travel.
xx = 0.5*[-22,-19,-12,-7,8,13,18,23,0.5,0.5, $
13,8,0.5,0.5,8,3,-2,-7,0,0,-7,-12,0,0]
yy = 2*[3,-0.7,-1,-1.5,-1.5,-0.7,0.5,3,3,5, $
5,13,13,15,15,20,20,15,15,13,13,5,5,3]
; Draw the boat.
p1 = POLYGON(xx,yy,/DATA,FILL_COLOR="burlywood")
; Translate p1 using data coordinates,
; translate e using device coordinates.
FOR i=1,99 do begin & $
p1.Translate, 1, y[i]-y[i-1], /DATA & $
e.Translate, 1,-0.5 & $
ENDFOR
graphic.Translate, X, Y, Z [, /DATA] [, /DEVICE] [, /NORMAL] [, /RESET]
The translation along the X, Y, and Z dimensions. A value of 0 indicates no translation. If Z is not supplied then the default is 0.
Set this keyword if the input arguments are specified in data coordinates.
Set this keyword if the input arguments are specified in device coordinates (pixels). This is the default behavior.
Set this keyword if the input arguments are specified in normalized [0, 1] coordinates.
Set this keyword to 1 to reset the translation to 0 before performing any translation. If RESET is specified then X, Y, and Z are optional.
8.0 |
Introduced |